let Mock=require('mockjs');
let city=require('./city.json');
let store =require('./store.json')
let menu =require('./menu.json')

//扩展morkjs
Mock.Random.extend({
    phone:function(){
        let phonePrefixs=['177','198','138']//手机前缀
        return this.pick(phonePrefixs)+Mock.mock(/\d{8}/)
    }
})

Mock.mock('/login','post',function(options){
    console.log(options);
    return{
        status:200,
        msg:'登录成功',
        data:{
            userInfo:Mock.mock({
                'name':'@cname',
                'password':'123456',
                'star|1-20':1,
                'phone':'@phone',
                'common_address':[],
                'avatar':'https://ss1.baidu.com/9vo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D450%2C600/sign=a587b23df11f3a295a9dddcaac159007/500fd9f9d72a60590cfef2f92934349b023bba62.jpg'
            })
        }
    }
})

Mock.mock('/api/getVerificationCode','get',{
    status:200,
    msg:'生成成功',
    data:{
        'num|100000-999999':1
    }
})

Mock.mock('/api/labelMap','get',{
    status:0,
    msg:'success',
    data:{
        data:{
            '0':'家',
            '1':'公司',
            '2':'其他'
        }
    }
})

Mock.mock('/api/getCities','get',{
    status:0,
    msg:'success',
    data:{
        cities:city
    }
})

Mock.mock(RegExp('/api/getStore.*'),'get',function(option){
    return store;
})

Mock.mock('/api/getMenu','get',menu)